Skip to main content

MTFastMemory

MTFastMemory is a interface for the Fast Logic Memory interactable in the mod which allows highly compact memory which is usuable with interface blocks and computers.


Functions

setValue

MTFastMemory:setValue(key, value)

Sets the value of a single key in the memory block.

Parameters:

  • key [ number ] The key to write to.
  • value [ number ] The value to store.

getValue

MTFastMemory:getValue(key)

Retrieves the value stored at a specific key in the memory block.

Parameters:

  • key [ number ] The key to read from.

Returns:

  • [ number ] The value stored at the key, or 0 if the key does not exist.

setValues

MTFastMemory:setValues(kvPairs)

Sets values for multiple keys at once.

Parameters:

  • kvPair` [ table<number, number> ] A table of key-value pairs to store.

getValues

MTFastMemory:getValues(keys)

Retrieves the values for multiple keys.

Parameters:

  • keys [ number[] ] An array of keys to read.

Returns:

  • [ number[] ] An array of values corresponding to the given keys.

clearMemory

MTFastMemory:clearMemory()

Clears all data from the memory block.


setMemory

MTFastMemory:setMemory(memory)

Overwrites the entire memory block with a new table.
Equivalent to calling clearMemory followed by setValues.

Parameters:

  • memory [ table<number, number> ] The new memory contents.

getMemory

MTFastMemory:getMemory()

Returns the current contents of the memory block.

Returns:

  • [ table<number, number> ] A table representing the full memory contents.